<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理</title>
    <link rel="stylesheet" href="./others/layui/css/layui.css">
</head>
<body>
    <script src="./others/jquery/jquery-3.6.0.js"></script>
    <script src="./others/layui/layui.js"></script>
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <div class="layui-logo layui-bg-black">后台管理</div>
            <!-- 头部区域（可配合layui 已有的水平导航） -->
            <ul class="layui-nav layui-layout-left">
                <li class="layui-nav-item layui-hide-xs">
                    <a href="./blog_add.html">
                        <i class="layui-icon">&#xe642;</i>写文章
                    </a>
                </li>
            </ul>
        
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                    <a href="javascript:;">
                    <img src="./img/head1.png" class="layui-nav-img">
                        username
                    </a>
                    <dl class="layui-nav-child">
                    <dd><a href="#"><i class="layui-icon">&#xe770;</i>个人资料</a></dd>
                    <dd><a href="#"><i class="layui-icon">&#xe607;</i>帮助中心</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="#">退出</a>
                </li>
            </ul>
        </div>
        <div class="layui-body">

            <!-- 文件列表 -->
            <!-- <div style="padding: 15px;">内容主体区域。记得修改 layui.css 和 js 的路径</div> -->
            <table class="layui-table" lay-skin="nob">
                <colgroup>
                  <col width="250">
                  <col width="100">
                  <col width="100">
                  <col width="300">
                </colgroup>
                <thead>
                  <tr>
                    <th>标题</th>
                    <th>访问</th>
                    <th>发布时间</th>
                    <th>操作</th>
                  </tr> 
                </thead>
                <tbody>
                  <tr>
                    <td>文章1</td>
                    <td>10</td>
                    <td>2020-2-2</td>
                    <td class="layui-btn-group">
                        <button class="layui-btn layui-btn-warm updateBtn">修改</button>
                        <button type="button" class="layui-btn layui-btn-danger deleteBtn">删除</button>
                    </td>
                  </tr>
                  <tr>
                    <td>文章2</td>
                    <td>10</td>
                    <td>2020-2-2</td>
                    <td class="layui-btn-group">
                        <button class="layui-btn layui-btn-warm updateBtn">修改</button>
                        <button type="button" class="layui-btn layui-btn-danger deleteBtn">删除</button>
                    </td>
                  </tr>
                </tbody>
              </table>
              <div id="page" class="layui-row"></div>
        
        </div>
    </div>

    <script>
        $(".deleteBtn").on("click",function() {
            var title = $(this).parent().parent().children().eq(0).text();
            layer.confirm('确定删除《' + title + '》？', {icon: 3, title:'提示'}, function(index){
                
                //do something

                console.log("删除");
                layer.close(index);
            });
        })

        layui.use('laypage', function() {
            var laypage = layui.laypage;
            laypage.render({
                elem: 'page',
                count: 30, // 数据总记录数，从服务端得到
                limit: 10, // 每页数据数
                curr: 1, // 当前页
                jump: function(obj, first){
                    //首次不执行
                    if(!first){
                        //do something
                        window.location = "";
                    }
                }
            });
        });
    </script>

</body>
</html>